package com.ithema.mArrayList;

import java.util.Random;

public class Chou {
    public static void main(String[] args) {
        //一个大V直播抽奖，奖品是现金红包，分别有{2, 588, 888, 1000, 10000}五个奖金。请使用代码模拟抽奖，打印出每个奖项，
        // 奖项的出现顺序要随机且不重复。打印效果如下：（随机顺序，不一定是下面的顺序）
        int[] arr ={2,588,888,1000,10000};
        int[] arr1=new int[5];
        int dexint=0;
        Random random =new Random();

        while (dexint<arr.length){
            int i =random.nextInt(arr.length);
            if (kang(arr1,arr[i])==false){
                System.out.println(arr[i]+"元的奖金被抽走了");
                arr1[dexint]=arr[i];
                dexint++;
            }
        }
    }
    public static boolean kang( int[]arr1  ,int num) {
        for (int i = 0; i < arr1.length; i++) {
            if (arr1[i] == num) {
                return true;
            }
        }
        return false;
    }
}
